home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / try_qb / mandel.bas (.txt) < prev    next >
QuickBASIC Tokenized Source  |  1989-12-04  |  5KB  |  98 lines

  1. ShiftPalette
  2. WindowVals
  3. ScreenTest
  4. FALSE
  5. TRUEi
  6. MAXLOOP
  7. MAXSIZE
  8. PaletteArray5
  9. WLeft
  10. WRight
  11. WBottom
  12. EgaMode
  13. ColorRange
  14. VLeft
  15. VRight
  16. VBottom
  17. XLength
  18. YLength
  19. ColorWidth
  20. LogicY
  21. OldColor
  22. LogicX
  23. MandelX
  24. MandelY
  25. RealNum
  26. ImagNum
  27. PColor
  28.     BadScreen
  29.  Default variable type is integer
  30.  Boolean constants
  31.  Set maximum number of iterations per point:
  32.  Call WindowVals to get coordinates of window corners:
  33.  Call ScreenTest to find out if this is an EGA machine,
  34.  and get coordinates of viewport corners:n
  35.  Define viewport and corresponding window:
  36. Press any key to quit.
  37.  Loop through each pixel in viewport and calculate
  38.  whether or not it is in the Mandelbrot Set:
  39.  Loop through every line in:
  40.  the viewport.
  41.  Get the pixel's logical y
  42.  coordinate.
  43.  Plot leftmost pixel in the line.
  44.  Start with background color. 
  45.  Loop through every pixel in
  46.  the line.
  47.  Get the pixel's logical x
  48.  coordinate .t
  49.  Do the calculations to see if this point is in
  50.  the Mandelbrot Set:
  51.  Assign a color to the point:
  52.  If color has changed, draw a line from the
  53.  last point referenced to the new point,
  54.  using the old color:d
  55.  Draw the last line segment to the right edge of
  56.  the viewport:
  57.  If this is an EGA machine, shift the palette after
  58.  drawing each line:m
  59.  Continue shifting the palette until the user 
  60.  presses a key:i
  61.  Restore the screen to text mode, 
  62.  80 columns.
  63.  Error handler that is invoked if 
  64.  there is no EGA graphics card
  65. ShiftPalette
  66. = ShiftPalette 
  67.  Rotates the palette by one each time it is called.
  68. WindowVals
  69. = WindowVals 
  70.  Gets window corners as input from the user, or sets
  71.  values for the corners if there is no input.o
  72. This program prints the graphic representation of"
  73. the complete Mandelbrot Set. The default window is
  74. from (-1000,625) to (250,-625). To zoom in on part
  75. of the figure, input coordinates inside this window.
  76. Press <ENTER> to see the default window. Press any
  77. other key to input your own window coordinates: 
  78.  User didn't press ENTER, so input window corners:
  79. X coordinate of upper left corner: "
  80. X coordinate of lower right corner: 
  81. Right corner must be greater than left corner.
  82. Y coordinate of upper left corner: "
  83. Y coordinate of lower right corner: 
  84. Bottom corner must be less than top corner."
  85.  Pressed ENTER, so set default values.
  86. ScreenTest
  87. = ScreenTest 
  88.  Tests to see if user has EGA hardware with SCREEN 8.=
  89.  If this causes an error, the EM flag is set to FALSE,
  90.  and the screen is set with SCREEN 1. 
  91.  Also sets values for corners of viewport (VL = left,,
  92.  VR = right, VT = top, VB = bottom), scaled with the
  93.  correct aspect ratio so viewport is a perfect square.
  94.  No error, so SCREEN 8 is OK
  95.  16 colors (0 - 15)N
  96.  Error, so use SCREEN 1N
  97.  4 colors (0 - 3)E
  98.